//@author A0097978X
package flexiCommands;

import storage.TimeRange;
import storage.Time;
import storage.DateRange;
import storage.Date;

public class Command{
	
	private Time startTime = new Time();
	private Time endTime = new Time();
	private Date startDate = new Date();
	private Date endDate = new Date();


	private TimeRange rangeTime;
	private DateRange rangeDate;
	private String commandType, description, query;
	private int option;	

	public Command() throws Exception {
		rangeTime = new TimeRange(startTime, endTime);
		rangeDate = new DateRange(startDate, endDate);
		commandType = null;
		description = null;
		query = null;
		option = 0;
	}

	//============= Mutators ===============//

	public void setTimeRange(TimeRange times) {
		this.rangeTime = times;
	}

	public void setDateRange(DateRange dates) {
		this.rangeDate = dates;
	}																		

	public void setCommandType(String command) {
		this.commandType = command;
	}

	public void setDescription(String descriptions) {
		this.description = descriptions;
	}

	public void setQuery(String queries) {
		this.query = queries;
	}

	public void setOption(int choice) {
		this.option = choice;
	}


	//============= Accessors ==============//

	public TimeRange getTimeRange() {
		return this.rangeTime;
	}
	
	public Time getStartTime() {
		return this.rangeTime.getStartTime();
	}
	
	public Time getEndTime() {
		return this.rangeTime.getEndTime();
	}

	public DateRange getDateRange() {
		return this.rangeDate;
	}
	
	public Date getStartDate() {
		return this.rangeDate.getStartDate();
	}
	
	public Date getEndDate() {
		return this.rangeDate.getEndDate();
	}

	public String getCommandType() {
		return this.commandType;
	}

	public String getDescription() {
		return this.description;
	}

	public String getQuery() {
		return this.query;
	}

	public int getOption() {
		return this.option;
	}

	//============= Verifiers ==============//

	public boolean isTimeRangeComplete() {
		return this.rangeTime.isComplete();
	}

	public boolean isTimeRangeEmpty() {
		return this.rangeTime.isEmpty();
	}

	public boolean isStartTimeEmpty() {
		return this.rangeTime.getStartTime().isEmpty();
	}

	public boolean isEndTimeEmpty() {						
		return this.rangeTime.getEndTime().isEmpty();
	}

	public boolean isDateRangeComplete() {
		return this.rangeDate.isComplete();
	}

	public boolean isDateRangeEmpty() {
		return this.rangeDate.isEmpty();
	}

	public boolean isStartDateEmpty() {
		return this.rangeDate.getStartDate().isEmpty();
	}

	public boolean isEndDateEmpty() {						
		return this.rangeDate.getEndDate().isEmpty();
	}

	public boolean isDescriptionEmpty() {
		if(description == null)
			return true;
		else
			return false;
	}

	public boolean isQueryEmpty() {
		if(query == null)
			return true;
		else
			return false;
	}

	public boolean isOptionEmpty() {
		if(option == 0)
			return true;
		else
			return false;
	}

}